package com.dengcj.epl.web.api.common;


import com.dengcj.epl.service.ecology.workflow.NodeAction;
import com.dengcj.epl.web.entity.ApiResult;

import javax.ws.rs.Consumes;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

/**
 * @author dengchunjie
 * @Description: Ecology节点附加操作通用处理接口
 * @date 2022/1/12 15:04
 */
@Path("/common/ecology/nodeaction")
public class NodeActionEntrance {

    @Path("/execute")
    @POST
    @Produces("application/json;charset=utf-8")
    @Consumes("application/json;charset=utf-8")
    public String execute(String requestStr){
        ApiResult apiResult = new ApiResult<>();

        // 将数据传入入口类进行处理
        NodeAction nodeAction = new NodeAction();
        String result = nodeAction.execute(requestStr);

        if(!"".equals(result)){
            apiResult.error(result);
        }

        /**
         * {
         *     "msg": "success",
         *     "data": {
         *         "code": "A0001"
         *     },
         *     "status": true
         * }
         */
        return apiResult.toString();
    }
}
